'use strict'

const { defineConfig } = require('@vue/cli-service')
const port = process.env.port || process.env.npm_config_port || 8000
const path = require('path')
function resolve(dir) {
  return path.join(__dirname, dir)
}
module.exports = defineConfig({
  publicPath: './',
  outputDir: 'dist',
  assetsDir: 'static',
  transpileDependencies: true,
  lintOnSave: process.env.NODE_ENV === 'development',
  productionSourceMap: false,
  devServer: {
    client: {
      overlay: false
    },
    headers: {
      'Access-Control-Allow-Origin': '*'
    },
    port: port,
    open: true,//启动时打开默认游览器，可能会调用运行或cmd命令窗口打开游览器，如果安装了360，可能会被拦截
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:9528/api',
        ws: true, // 代理websockets
        changeOrigin: true, // 虚拟托管站点
        secure: false, // 如果是https接口，需要配置这个参数为true
        pathRewrite: {
          ['^' + '/api']: ''
        }
      }
    }
  }
})
